#include <bits/stdc++.h>

using namespace std;

int ia[1005];
int ib[1005];
int ic[3005];
string gjd(string a, string b);

int main(){
	string a="1";
	int b;
	int n = 0;
	int v;
	cin >> v >> b;
	for(int i = 1; i <= v; i++){
		stringstream s;
		s << i;
		string c;
		s >> c;
		a = gjd(a,c);
		s.clear();
	}
    cout << a;
    /*
	for(int i = 0; i < a.length(); i++){
		if(int(a[i])-48 == b){
			n+=1;
		}
	}
	cout << n;
    */
}

string gjd(string a, string b){
	memset(ia,0,sizeof(ia));
	memset(ib,0,sizeof(ib));
	memset(ic,0,sizeof(ic));
	int len1 = a.length();
	int len2 = b.length();
	string c = "";
	for(int i = 0; i < len1; i++){
		ia[i] = a[len1-1-i] - 48;
	}
	for(int i = 0; i < len2; i++){
		ib[i] = b[len2-1-i] - 48;
	}
	for(int i = 0; i < len1; i++){
		for(int j = 0; j < len2; j++){
			ic[i+j] += ia[i]*ib[j]; 
		}
	}
	int len3 = len1 + len2;
	for(int i = 0; i < len3; i++){
		ic[i+1] += ic[i] / 10;
		ic[i] %= 10;
	}
	while(len3 && ic[len3] == 0){
		len3--;
	}
	for(int i = len3; i >= 0; i--){
		c += char(ic[i]+48);
	}
	return c;
} 